package com.haoma.elasticsearch;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.elasticsearch.repository.ElasticsearchRepository;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * Description:
 */
@Repository
public interface ArticleMapper extends ElasticsearchRepository<ArticleEs,Long> {





    List<ArticleEs> findTop4ByStatusOrderByHotDescCreateTimeDesc(Integer status);

    List<ArticleEs> findTop5ByStatusOrderBySortAscCreateTimeDesc(Integer status);

    Page<ArticleEs> findByStatusOrderByCreateTimeDesc(Integer status, Pageable pageable);

    List<ArticleEs> findTop3ByStatusAndCategoryNameOrderBySortAscCreateTimeDesc( Integer status,String name);

    Page<ArticleEs> findByStatusAndCategoryNameOrderByCreateTimeDesc(Integer status, String name, PageRequest iPage);

    Page<ArticleEs> findByStatusAndLabelNameOrderByCreateTimeDesc(Integer status, String name, PageRequest iPage);

    List<ArticleEs> findByStatusOrderByCreateTimeDesc(Integer status);

    Page<ArticleEs> findByOrderByHotDesc(PageRequest of);

    Page<ArticleEs> findByOrderByUpdateTimeDesc(PageRequest of);

}
